package com.petAdoption.manager.controller;


import com.petAdoption.manager.service.IOrderlistService;
import com.petAdoption.manager.service.IProductlistService;
import com.petAdoption.manager.util.Result;
import com.petAdoption.manager.vo.OrderlistVO;
import com.petAdoption.manager.vo.ProductlistVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 王倩茹
 * @since 2023-08-28
 */
@RestController
@RequestMapping("/orderlist")
@Slf4j
public class OrdertlistController {
    @Resource
    private IOrderlistService orderlistService;
    @Resource
    private Result result;
    @GetMapping("/findAll/{productlistId}")
    public Result findAll(@PathVariable Integer productlistId){
        log.info("查询的id{}",productlistId);
        List<OrderlistVO> list = orderlistService.findAll(productlistId);
        if(list!=null && !list.isEmpty()){
            return result.success("查找成功",list);
        }
        return result.fail("查找失败");
    }
//    @GetMapping("/findAll/")
//    public Result findAll(){
//        List<OrderlistVO> list = orderlistService.findAll();
//        if(list!=null && !list.isEmpty()){
//            return result.success("查找成功",list);
//        }
//        return result.fail("查找失败");
//    }
}
